using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class SpecimenCollectionMethodAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public SpecimenCollectionMethodAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v27] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v25] = new string[]{"FNA","PNA","BIO","BCAE","BCAN","BCPD","CAP","CATH","EPLA","ESWA","LNA","CVP","LNV","MARTL","ML11","PACE","PIN","KOFFP","MLP","NYP","TMP","ANP","BAP","PRIME","PUMP","QC5","SCLP","SCRAPS","SHA","SWA","SWD","WOOD","TMOT","TMAN","TMCH","TMM4","TMMY","TMPV","TMSC","TMUP","TMVI","VENIP"};
						validVersionCodes[HL7Version.v251] = new string[]{"FNA","PNA","BIO","BCAE","BCAN","BCPD","CAP","CATH","EPLA","ESWA","LNA","CVP","LNV","MARTL","ML11","PACE","PIN","KOFFP","MLP","NYP","TMP","ANP","BAP","PRIME","PUMP","QC5","SCLP","SCRAPS","SHA","SWA","SWD","WOOD","TMOT","TMAN","TMCH","TMM4","TMMY","TMPV","TMSC","TMUP","TMVI","VENIP"};
						validVersionCodes[HL7Version.v26] = new string[]{"FNA","PNA","BIO","BCAE","BCAN","BCPD","CAP","CATH","EPLA","ESWA","LNA","CVP","LNV","MARTL","ML11","PACE","PIN","KOFFP","MLP","NYP","TMP","ANP","BAP","PRIME","PUMP","QC5","SCLP","SCRAPS","SHA","SWA","SWD","WOOD","TMOT","TMAN","TMCH","TMM4","TMMY","TMPV","TMSC","TMUP","TMVI","VENIP"};
						validVersionCodes[HL7Version.v27] = new string[]{"FNA","PNA","BIO","BCAE","BCAN","BCPD","CAP","CATH","EPLA","ESWA","LNA","CVP","LNV","MARTL","ML11","PACE","PIN","KOFFP","MLP","NYP","TMP","ANP","BAP","PRIME","PUMP","QC5","SCLP","SCRAPS","SHA","SWA","SWD","WOOD","TMOT","TMAN","TMCH","TMM4","TMMY","TMPV","TMSC","TMUP","TMVI","VENIP"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v25] = new string[]{"Aspiration, Fine Needle","Aterial puncture","Biopsy","Blood Culture, Aerobic Bottle","Blood Culture, Anaerobic Bottle","Blood Culture, Pediatric Bottle","Capillary Specimen","Catheterized","Environmental, Plate","Environmental, Swab","Line, Arterial","Line, CVP","Line, Venous","Martin-Lewis Agar","Mod. Martin-Lewis Agar","Pace, Gen-Probe","Pinworm Prep","Plate, Cough","Plate, Martin-Lewis","Plate, New York City","Plate, Thayer-Martin","Plates, Anaerobic","Plates, Blood Agar","Pump Prime","Pump Specimen","Quality Control For Micro","Scalp, Fetal Vein","Scrapings","Shaving","Swab","Swab, Dacron tipped","Swab, Wooden Shaft","Transport Media,","Transport Media, Anaerobic","Transport Media, Chalamydia","Transport Media, M4","Transport Media, Mycoplasma","Transport Media, PVA","Transport Media, Stool Culture","Transport Media, Ureaplasma","Transport Media, Viral","Venipuncture"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Aspiration, Fine Needle","Aterial puncture","Biopsy","Blood Culture, Aerobic Bottle","Blood Culture, Anaerobic Bottle","Blood Culture, Pediatric Bottle","Capillary Specimen","Catheterized","Environmental, Plate","Environmental, Swab","Line, Arterial","Line, CVP","Line, Venous","Martin-Lewis Agar","Mod. Martin-Lewis Agar","Pace, Gen-Probe","Pinworm Prep","Plate, Cough","Plate, Martin-Lewis","Plate, New York City","Plate, Thayer-Martin","Plates, Anaerobic","Plates, Blood Agar","Pump Prime","Pump Specimen","Quality Control For Micro","Scalp, Fetal Vein","Scrapings","Shaving","Swab","Swab, Dacron tipped","Swab, Wooden Shaft","Transport Media,","Transport Media, Anaerobic","Transport Media, Chalamydia","Transport Media, M4","Transport Media, Mycoplasma","Transport Media, PVA","Transport Media, Stool Culture","Transport Media, Ureaplasma","Transport Media, Viral","Venipuncture"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Aspiration, Fine Needle","Aterial puncture","Biopsy","Blood Culture, Aerobic Bottle","Blood Culture, Anaerobic Bottle","Blood Culture, Pediatric Bottle","Capillary Specimen","Catheterized","Environmental, Plate","Environmental, Swab","Line, Arterial","Line, CVP","Line, Venous","Martin-Lewis Agar","Mod. Martin-Lewis Agar","Pace, Gen-Probe","Pinworm Prep","Plate, Cough","Plate, Martin-Lewis","Plate, New York City","Plate, Thayer-Martin","Plates, Anaerobic","Plates, Blood Agar","Pump Prime","Pump Specimen","Quality Control For Micro","Scalp, Fetal Vein","Scrapings","Shaving","Swab","Swab, Dacron tipped","Swab, Wooden Shaft","Transport Media,","Transport Media, Anaerobic","Transport Media, Chalamydia","Transport Media, M4","Transport Media, Mycoplasma","Transport Media, PVA","Transport Media, Stool Culture","Transport Media, Ureaplasma","Transport Media, Viral","Venipuncture"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Aspiration, Fine Needle","Arterial puncture","Biopsy","Blood Culture, Aerobic Bottle","Blood Culture, Anaerobic Bottle","Blood Culture, Pediatric Bottle","Capillary Specimen","Catheterized","Environmental, Plate","Environmental, Swab","Line, Arterial","Line, CVP","Line, Venous","Martin-Lewis Agar","Mod. Martin-Lewis Agar","Pace, Gen-Probe","Pinworm Prep","Plate, Cough","Plate, Martin-Lewis","Plate, New York City","Plate, Thayer-Martin","Plates, Anaerobic","Plates, Blood Agar","Pump Prime","Pump Specimen","Quality Control For Micro","Scalp, Fetal Vein","Scrapings","Shaving","Swab","Swab, Dacron tipped","Swab, Wooden Shaft","Transport Media,","Transport Media, Anaerobic","Transport Media, Chalamydia","Transport Media, M4","Transport Media, Mycoplasma","Transport Media, PVA","Transport Media, Stool Culture","Transport Media, Ureaplasma","Transport Media, Viral","Venipuncture"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
